home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_137 / ct / ct.zoo / ct.readme < prev    next >
Text File  |  1988-03-13  |  11KB  |  214 lines

  1.                   
  2.  
  3.                   CT IMAGE PROCESSING PROGRAM DOCUMENTATION.
  4.  
  5.     The program CT is copyright 1987 by Jon Harman.  It is freely
  6. distributable as long as this documentation is included.  I can be 
  7. contacted at:
  8.  
  9.             Jon Harman
  10.             Imatron
  11.             389 Oyster Point Blvd.
  12.             S San Francisco, CA 94080
  13.             (415) 583-9964
  14.  
  15.     I wrote this program as a tool at work to help me test out ideas.
  16. Because I only intended it for my own use it has a very rudimentary user
  17. interface.  For this I apologize.  I hope this documentation can ease some
  18. of the difficulties.
  19.  
  20. Getting Started:
  21.     The program must be started from the CLI.  It's name is CT.  If the
  22. program is unable to get enough memory to function it will say so then die.
  23. You can specify the number of image buffers to try to open on the command
  24. line (example: ct 2).  If it can't open that many it will tell you how many 
  25. it could open.  The default number of buffers is 5.  The program is a
  26. memory hog, but a 512k system can get 2 buffers if you type control-d
  27. right at startup.
  28.     The program has a very brief help message which is displayed when you
  29. type ?.  All commands to the program start with a single letter, are followed
  30. by 0 or more integers which select image buffers to be used by the command,
  31. and are terminated by a return.  Upper case does not equal lower case.
  32.  
  33. For example (I do not show the return needed after each line): 
  34. First get into the CT directory. Type:                 cd df1:ct
  35. To start the program type:                             ct
  36. To read in an image into buffer 0 type:                r 0 
  37. then when it asks for the filename reply:              skull.img 
  38. To display the image type:                             d 0 
  39. To change the scaling type:                            s 200 0
  40. To display the buffer on the right side
  41. with the new scaling type:                             D 0
  42. To zoom in on the display position the cursor over
  43. the desired point then hit the right mouse button.
  44. To exit the program type:                              q 
  45.  
  46. Image files on this disk:
  47.     These images are all CT scans of real people.  I've included a sampling
  48. of scans of various parts of the body.  A CT scan shows anatomy as if
  49. the patient was sliced perpendicular to his long axis.  This can be a
  50. little confusing at first.  The patient's right side is on the left side
  51. of the image.
  52.  
  53. The images are:
  54. SKULL.IMG:  A slice through the skull at the level of the eyes.  Use a
  55.             wide window to see bone detail.  Use a narrow window to see
  56.             soft tissue detail (s 200 0 for example.)  With a narrow
  57.             window you can see the eyeballs inside the orbits.  If you
  58.             look closely you can even see the optic nerve.
  59. BRAIN5.IMG: A slice higher up showing the brain.  Use s 50 50.  The dark
  60.             areas are ventricles.
  61. BRAIN8.IMG: A slice even higher than brain5.  Use s 50 50.
  62. HEART.IMG:  This is an image of the chest showing the heart.  Our scanner
  63.             is the only CT scanner capable of imaging the beating heart.
  64.             The patient has been injected with an iodine based contrast
  65.             solution which causes the blood to appear white.  Use s 500 50.
  66.             The right ventricle is the brighest part of the heart (on the
  67.             left side in this image.)  The left ventricle is to the right,
  68.             separated by the septum.  The right atrium is to the lower left
  69.             of the right ventricle.  The small circular object below the
  70.             heart is the descending aorta.  Use s 500 -800 to see the lungs.
  71. SPINE.IMG:  This image is of the L4-5 (the space between the 4th and 5th
  72.             lumbar vertebra) region of the spine.  Compared with the other
  73.             images the scale is much enlarged.  The scan shows a herniated
  74.             disk.  Use s 500 0.
  75. ABD.IMG:    This scan is at the level of the sacrum.  Use s 400 50.
  76.  
  77. Image format:
  78.     Images are stored in files with a very simple format: a 256x256 array
  79. of 16 bit integers.  Each file is 131072 bytes long.  The program assumes
  80. the gray level data is in the low 11 bits of each word.  Thus gray levels
  81. can vary from 0 to 2047.  The program maps the gray levels into a CT number
  82. scale that ranges from -1000 to +1047.  It is this CT scale that is used by
  83. the s command to set the display scaling.
  84.  
  85. Image scaling and display:
  86.     Although the images have 11 bits of gray level information the display
  87. has only 4 bits (16 gray levels).  You specify how to map the 11 bits into
  88. 4 bits by using the s command.  The command has two parameters: window and
  89. level.  The window can be any integer from 1 to 2048, the level can vary
  90. from -1000 to 1047.  The window specifies the size of the CT number range
  91. which gets mapped to the 16 display gray levels.  The level specifies the
  92. center of the range.   The defaults are window = 2048, level = 0.  These
  93. are fine for looking at the boney part of a skull but a more narrow window
  94. is needed to see detail in brain or body tissue.  A window of 100 would be
  95. more appropriate for the brain images.  The smaller the window the higher
  96. the contrast.  A window of 1 gives a black and white display with all
  97. CT values less than or equal the level becomming black and values greater
  98. becomming white.
  99.     You can display the image in one of two places.  The d command displays
  100. on the left side, the D command displays on the right side.  Both commands
  101. need you to specify the image buffer to be displayed.  If you want to see
  102. a portion of the display in greater detail there is a zoom command.  Position
  103. the pointer over the area to be zoomed and then either click the right mouse
  104. button or enter z or Z.
  105.  
  106. Other functions:
  107.     I've included a variety of image processing functions.  They often
  108. produce very interesting images.  The v functions are convolutions:
  109. averaging, laplacian, unsharp masking.  The e functions are edge detection
  110. functions: absolute value of the gradient, value of the gradient in various
  111. directions.  You may have to play with the window and level values to
  112. display these images properly.  To find out what the image values are in
  113. a region of interest use the n function.  Type n <buffer number> <ret> and
  114. place the pointer over the region of interest in the left display area.
  115. The program will tell you the pointer position and image value at that
  116. position.  If you type return you get the values in a neighborhood of
  117. the point.  To display the region with maximum contrast choose a window
  118. the same size as the maximum difference of CT values in the region and 
  119. choose a level equal to the median CT value in the region.
  120.  
  121.  
  122.                  Description of commands.
  123.  
  124. ?           Print help message.  Shows number of buffers available and their
  125.             numbering.
  126.  
  127. r <buf>     Read image from file into buffer.  Will ask for file name.
  128.  
  129. w <buf>     Write buffer to file.
  130.  
  131. s <win> <lev>  Set display scaling. Use S to automatically display the last
  132.                displayed buffer with the new scaling.
  133.  
  134. d <buf>     Display buffer on left.  Use D to display on right.
  135.  
  136. z           Zoom in on display.  Same as clicking right mouse button.  Uses
  137.             the upper zoom area. Use Z to zoom to the lower zoom area.
  138.  
  139. m <buf1> <buf2>  Move buf1 to buf2.
  140.  
  141. c <color>   Change the color table.  Table 0 is the default.  Table 1 gives
  142.             negative images.  Table 3 gives pseudo colors ranging from 0=blue
  143.             to 15=red.  Will ask if you want to clear the display.
  144.  
  145. n <buf>     Look at values of image at a point.  Until you type return it will
  146.             display the x,y position of the pointer and the image CT number
  147.             at that point.  Use N to skip this and just type out the CT 
  148.             numbers in a neighborhood of the pointer.
  149.  
  150. i <buf>     Computes mean and standard deviation of an elliptical region of
  151.             interest (ROI).  Use I for a rectangular ROI.  Use the right mouse
  152.             button to resize the ROI.
  153.  
  154. h <buf>     Display histogram of buffer in right display.  Use H if you
  155.             want to specify a subrectangle to histogram.
  156.  
  157. b           Toggle screen to back.  Moving the screen to the back can speed
  158.             up the computations a little.
  159.  
  160. t <buf>     Generate test patterns. 
  161.  
  162. a <buf1> <buf2> <buf3>  Do arithmatic on buffers. The sources are buf1 and
  163.                         buf2, the destination is buf3.  Buf1 can equal buf2
  164.                         can equal buf3.
  165.                  You can choose:
  166.                  +: buf3[i] = (buf1[i] + buf2[i])/ 2
  167.                  -: buf3[i] = (buf1[i] - buf2[i] + 1000)
  168.                  &: buf3[i] = buf1[i] & buf2[i]  (and)               
  169.                  |: buf3[i] = buf1[i] | buf2[i]  (or)             
  170.                  ^: buf3[i] = buf1[i] ^ buf2[i]  (exclusive or)             
  171.                  a: buf3[i] = (scale * (buf1[i] + buf2[i]) + offset)/ divsor
  172.  
  173. v <buf1> <buf2> Convolutions.  You must have buf1 != buf2.
  174.                  You can choose:
  175.                  a: average of 9 neighbors.  kernel = (1,1,1;1,1,1;1,1,1)/9.
  176.                  g: gaussian average.  kernel = (1,2,1;2,4,2;1,2,1)/16.
  177.                  v: vertical average.  kernel = (0,1,0;0,2,0;0,1,0)/4.
  178.                  h: horizontal average. kernel = (0,0,0;1,2,1;0,0,0)/4.
  179.                  l: laplacian. kernel = (-1,-1,-1;-1,8,-1;-1,-1,-1) + 1000.
  180.                  u: unsharp mask. kernel = (-1,-1,-1;-1,24,-1;-1,-1,-1)/16.
  181.                  f: a special adaptive filter.  Larger threshold gives more
  182.                     smoothing.
  183.  
  184. e <buf1> <buf2> Edge functions.  You must have buf1 != buf2.
  185.                  You can choose:
  186.                  a: absolute value of gradient. (use s 400 -800 to display)
  187.                  v: gradient in vertical direction. (use s 400 0 to display)
  188.                  h: gradient in horizontal direction.           "
  189.                  d: gradient in diagonal direction.             "
  190.                  e: gradient in opposite diagonal direction.    "
  191.  
  192. f <buf1> <buf2> Functions of binary images.  You must have buf1 != buf2.
  193.                  A binary image is one in which the only values are 0 or 1.
  194.                  (In this case -1000 or 1047.)  
  195.                  You can choose:
  196.                  t:threshold - create a binary image from a gray scale image.
  197.                  ~:complement
  198.                  g:8-neighbor grow (dilation)
  199.                  G:4-neighbor grow (dilation)
  200.                  s:8-neighbor shrink (erosion)
  201.                  S:4-neighbor shrink (erosion)
  202.                  l:a special edge finding function used on laplacian images
  203.                  c:contour at level
  204.  
  205. x        Execute outside program.  Doesn't work.  I wanted to be able to
  206.          execute separately compiled programs using this command.  I pass
  207.          the screen pointer and the pointers to the buffers to the new
  208.          program as hex strings via the argv array.  This works fine as
  209.          long as the program doesn't try to do graphics to the screen.
  210.          Then it crashes the system.  Must be blitter conflicts.  Any help
  211.          on this would be appreciated.
  212.  
  213.  
  214.